<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page pageEncoding="UTF-8" %>
<%@ include file="../common/common.jsp"%>
<%@ page import="jp.co.technotree.apl.cmd.master.Mst4000Bean;" %>
<jsp:useBean id="formBean" class="jp.co.technotree.apl.cmd.master.Mst4000Bean" scope="request" />
<%
	Mst4000Bean.Record[] recordList = formBean.getRecordList();

//--------------------------------------------ページングＳＴＡＲＴ------------------------------------------------------------------------
	Mst4000Bean.PagerData[] pagerDataList = formBean.getPagerDataList();

	int nowPageNo = formBean.getPageNo();


	//初期ページが0になっていたら1にする
	if(nowPageNo == 0){
		nowPageNo = 1;
	}

	int prevPageNo = nowPageNo - 1;
	int nextPageNo = nowPageNo + 1;

	int stPage = 1;
	int edPage = 0;


	if(pagerDataList != null){
		edPage = pagerDataList.length;
	}

	int startLoopNum = formBean.getStartLoopNum();
	int endLoopNum = formBean.getEndLoopNum();
	int sideNum = 5;

	boolean isPrev = (nowPageNo != stPage);
	boolean isNext = (nowPageNo != edPage);
	boolean isMinPrev = (nowPageNo - sideNum > stPage);
	boolean isMaxNext = (nowPageNo + sideNum < edPage);
	//--------------------------------------------ページングＥＮＤ------------------------------------------------------------------------


%>
<html>
	<head>
		<title>予備品管理システム - ユーザー情報一覧画面</title>
		<link rel="SHORTCUT ICON" href="../common/img/default/sys_icon.ico">

		<link rel='stylesheet' type='text/css' href='../../common/css/common/base.css' >
		<link rel='stylesheet' type='text/css' href='../../common/css/common/common.css'>
		<link rel='stylesheet' type='text/css' href='../../common/css/master/mst4000.css'>

		<script language="javascript" src="../../common/js/base.js"></script>
		<script language="javascript" src="../../common/js/menu/topmenu.js"></script>

		<!-- システムログ -->
		<script src="../../common/js/systemlog.js"></script>

			<style type='text/css'>
				.LinkItem {
					cursor: pointer;
				}
				.div-wid {
					border-bottom:solid 1px #ccc;
					width:780px; /* 横幅合計 + スクロールバー分 */
					height:380px;
					overflow:auto;
				}
			</style>

		<script language="javascript">
			function onInit(){
				//topBackChange(0);
				//httpRequest();
			}
			function screen_back() {
				//location.href="../topmenu/top1000";
				nextPageJump("topmenu1000");
			}

			function insertSerch(){
				//location.href="../mst5000/mst5000";
				nextPageJump("mst5000");
			}
			function updateSerch(dataId) {
				//location.href="../mst5000/mst5000?outputCate=2&keyUsrId="+id;
				document.getElementById("dataId").value = dataId;
				nextPageJump("mst5000");
			}
			function nextPageJump(nextPage){

				mainForm = document.getElementById("F1");
				document.getElementById("nextPage").value = nextPage;

				mainForm.submit();
			}

			//ソート
			function changeColumnSort(key) {
				var formName = "main";
				var frm = document[formName];
				frm.columnSortSelect.value = key;
				frm.submitFlag.value = "1";
				frm.cmd.value = "cmd01";
				//ページ番号初期化
				frm.pageNo.value ="1";
				frm.submit();
			}

			//ページングリンクを押したときの処理
			function wzdPager(pageNo) {
				var frm = document.forms["main"];

				frm.pageNo.value=pageNo;
				frm.submitFlag.value="1";
				frm.cmd.value='cmd01';
				frm.submit();

			}
		</script>

	</head>

	<body onLoad="onInit()" style="margin: 0px 4px 0px 0px;">
		<form class="frmMain" name="main" id="F1" action="./mst4000" method="post" enctype="multipart/form-data" onsubmit="return false;">
			<table class="tblMain" width="100%" cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td valign="top">
						<table class='main-width-tb'  cellspacing='0' cellpadding='0' border='0'><tr><td></td></tr></table>
						<table class='main-height-tb' cellspacing='0' cellpadding='0' border='0'><tr><td></td></tr></table>

						<!-- Header Menu START -->
						<div class="header-title">予備品管理システム(<%=formBean.kojou%>)</div>
						<!-- Header Menu END -->

						<!-- ***** [FORM] MAIN-FORM ***** -->
						<div id="lc-out" style="z-index: 0;">
							<div id="lc-in" style="z-index: 0">

								<div class="TxtCenter" style="margin: 20px ; width: 98%;">
									<div class="subtitle">ユーザー情報一覧画面</div>
									<table  border="0" style="width: 98%;">
										<tr>
											<td>
												<table border="0" width=98%>
													<tr>
														<td class="TxtRight">
															<input type="image" src="../../common/img/pc/btn_new_insert_off.png" onclick="insertSerch();" alt="新規登録">
															&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
															<input type="image" src="../../common/img/pc/btn_back_off.png" onclick="screen_back();">
														</td>
													</tr>
													<!-- スペース -->
													<tr style="height: 10px;"><td></td></tr>
												</table>
											</td>
										</tr>
									</table>
								</div>
								<div id="lc-in_under" style="z-index: 0">
								<!-- スペース -->
								<table style="height:10px;"><tr><td></td></tr></table>
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::ページング START:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->

<%
int recordCount = 0;
if (recordList != null) {
	recordCount = recordList.length;
}
if ("1".equals(formBean.getSubmitFlag())&& recordCount > 0) {
%>
				<table id="tblPager" width=""  align="center">
					<tr align="left">
						<td id="tblPager2" align="right" width="">
				<%
					if(isMinPrev){
				%>
							<a id="pagerBtnLinkNoBorder" href="javascript:wzdPager(<%= stPage %>);"><<<</a>&nbsp;&nbsp;&nbsp;&nbsp;
				<%
					}
				%>
						</td>
						<td id="tblPager2" align="right" width="">
				<%
					if(isPrev){
				%>
							<a id="pagerBtnLinkNoBorder" href="javascript:wzdPager(<%= prevPageNo %>);">前へ</a>&nbsp;&nbsp;&nbsp;&nbsp;
				<%
					}
				%>
						</td>
						<td id="tblPager2" align="center" width="">
				<%
					for(int i=startLoopNum;i<endLoopNum;i++){
						Mst4000Bean.PagerData pageData = pagerDataList[i];

						if(nowPageNo == pageData.Page){
				%>
							&nbsp;<span id="pagerLinkBorder"><a id="pagerLink" name="<%= pageData.Page %>" href="javascript:wzdPager(<%= pageData.Page %>);"><%= pageData.Page %></a></span>&nbsp;
				<%
						}else{
				%>
							&nbsp;<span id="pagerBtnLinkBorder"><a id="pagerBtnLink" href="javascript:wzdPager(<%= pageData.Page %>);"><%= pageData.Page %></a></span>&nbsp;
				<%
						}
					}
				%>
						</td>

						<td id="tblPager2" align="left" width="">
				<%
					if(isNext){
				%>
&nbsp;&nbsp;&nbsp;&nbsp;
							<a id="pagerBtnLinkNoBorder" href="javascript:wzdPager(<%= nextPageNo %>);">次へ</a>
				<%
					}
				%>
						</td>
						<td id="tblPager2" align="left" width="">
				<%
					if(isMaxNext){
				%>
&nbsp;&nbsp;&nbsp;&nbsp;
							<a id="pagerBtnLinkNoBorder" href="javascript:wzdPager(<%= edPage %>);">>>></a>
				<%
					}
				%>
						</td>
					</tr>
				</table><br>
	<%}
 %>

<!-- :::::::::::::::::::::::::::::::::::::::::::::::ページング END:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->

									<!-- ユーザー情報一覧 -->
									<table  border="0" style="width: 98%;" class="TxtCenter">
										<tr>
											<td>
												<!-- header column  -->
												<table  border="1" width="760px" height="30px" class="data-grid" >
													<thead>
														<tr>
															<th class="TblField1" style="background-color: #CAE1FF;">&nbsp;</th>
															<th class="TblField2" style="background-color: #CAE1FF;" onclick="changeColumnSort('mu.usr_id');">従業員コード	<%=formBean.getSort().getSortText("mu.usr_id")%></th>
															<th class="TblField3" style="background-color: #CAE1FF;" onclick="changeColumnSort('mu.usr_nm');">従業員名		<%=formBean.getSort().getSortText("mu.usr_nm")%></th>
															<th class="TblField4" style="background-color: #CAE1FF;" onclick="changeColumnSort('class1');">組				<%=formBean.getSort().getSortText("class1")%></th>
															<th class="TblField5" style="background-color: #CAE1FF;" onclick="changeColumnSort('mu.admin_div');">管理者		<%=formBean.getSort().getSortText("mu.admin_div")%></th>
															<th class="TblField6" style="background-color: #CAE1FF;" onclick="changeColumnSort('mu.seq');">並び順			<%=formBean.getSort().getSortText("mu.seq")%></th>
															<th class="TblField7" style="background-color: #CAE1FF;">&nbsp;</th>
														</tr>
													</thead>
												</table><!-- header column  -->
												<div class="div-wid" id="div-wid">
<%
		if ( recordList!=null) {
			if ( recordList.length == 0 ){
%>
		<table height="120px">
			<tr>
				<td colspan="7">データが存在しません。</td>
			</tr>
		</table>
<%
			}
%>
													<table  border="1" width="760px" height="30px" class="data-grid" >
<%
			for (int i=0; i<recordList.length; i++) {
				Mst4000Bean.Record record=recordList[i];
				//担当者のスプリット
				String usrNm = record.usrNm;
				String[] strUsrNm = usrNm.split("\\s+");;
				if(strUsrNm.length > 1){
					usrNm = strUsrNm[0];
				}
				String disStyle = "";
				if("1".equals(record.delDiv)){
					disStyle = "color:red;";
				}
%>
														<tr style="background-color: <%=("true".equals(record.colorFlg))?"#FFFFFF":"" %>";>
															<td style="<%=disStyle%>" class="TxtCenter TblField1">
																<!-- ２ページ目以降も連番で表示されるように計算 -->
																<%=(i+1)+((nowPageNo-1)*formBean.getLimit())%>
															</td>
															<td style="<%=disStyle%>" class="TblField2"><%=record.usrId %></td>
															<td style="<%=disStyle%>" class="TblField3"><%=record.usrNm %></td>
															<td style="<%=disStyle%>" class="TblField4"><%=record.class1 %></td>
															<td class="TxtCenter TblField5" style="<%=disStyle%>"><%=("1".equals(record.adminDiv)? "○": "&nbsp")%></td>
															<td class="TxtCenter TblField6" style="background-color: #BBFFFF; <%=disStyle%>"><%=record.seq %></td>
															<td class="TxtCenter TblField7" style="<%=disStyle%>"><input type="button" value="変更" onclick="updateSerch('<%=record.usrId %>')" alt="編集"></td>
														</tr>
<%
			}
		}
%>
													</table>
												</div>
											</td>
										</tr>
									</table>
							</div><!-- lc-in End -->


							<!-- ログ Start -->
							<!-- ログ End -->

						</div><!-- lc-out  -->
					</td>
				</tr>
			</table>

			<input type="hidden" name="cmd" value="cmd01">
			<input type="hidden" name="submitFlag" id="submitFlag" value="">
			<input type="hidden" id="nextPage" name="nextPage" value="">
			<input type="hidden" id="dataId" name="dataId" value="">
			<!-- カラムソート -->
			<input type="hidden" name="columnSortText" value="<%=formBean.getColumnSortText()%>">
			<input type="hidden" name="columnSortSelect" value="">

			<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::ページング START:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
			<input type="hidden" name="pageNo" value="<%= nowPageNo %>">
			<input type="hidden" name="selectPageNo" value="<%=formBean.getSelectPageNo()%>">
			<!-- :::::::::::::::::::::::::::::::::::::::::::::::ページング END:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
		</form>
	</body>
</html>
